#ifndef __SL_CMT_H__
#define __SL_CMT_H__

#include "iodefine.h"
#include "sl_types.h"

enum ClockSelection
{
	CKS_Divisor8 = 0,
	CKS_Divisor32 = 1,
	CKS_Divisor128 = 2,
	CKS_Divisor512 = 3
};

volatile struct st_cmt0 *sl_cmt_get(int channel);
void sl_cmt_reset(volatile struct st_cmt0 *pcmt);

void sl_cmt_start_timer(volatile struct st_cmt0 *pcmt);
void sl_cmt_stop_timer(volatile struct st_cmt0 *pcmt);

void sl_cmt_match_flag(volatile struct st_cmt0 *pcmt);
void sl_cmt_clear_counter(volatile struct st_cmt0 *pcmt);

void sl_cmt_enable_irq(volatile struct st_cmt0 *pcmt);
void sl_cmt_disable_irq(volatile struct st_cmt0 *pcmt);

void sl_cmt_set_slock(volatile struct st_cmt0 *pcmt, enum ClockSelection cs);void sl_cmt_set_timer_interval(volatile struct st_cmt0 *pcmt,WORD interval);

#endif
